package com.yc.sakuralxm.uestcscanning.tools

import android.view.View

import java.util.Calendar

/**
 *
 * Created by sakuraLxm on 2016/12/3.
 * 麻花藤坑壁微信启动太慢 日
 */
abstract class NoDoubleClickListener : View.OnClickListener {
    private var lastClickTime: Long = 0

    override fun onClick(v: View) {
        val currentTime = Calendar.getInstance().timeInMillis
        L.i("-----这是连续点击的时间差---" + (currentTime - lastClickTime))
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime
            onNoDoubleClick(v)
        }

    }

    protected abstract fun onNoDoubleClick(v: View)

    companion object {
        private val MIN_CLICK_DELAY_TIME = 1000
    }

}
